<!DOCTYPE html>
<html lang="en">
<head>
    <title>罚款详情</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=4a6c1b54">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">
    <style type="text/css">
        .table-width {
            width: 100%;
        }

        .title {
            font-size: 20px;
            text-align: center;
            margin-bottom: 8px;
        }

        .row {
            margin-right: -15px;
            margin-left: 0px;
        }

        .col-md-12 {
            padding-left: 0;
        }

        .infoReport {
            text-align: left;
        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }

        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 50px;
            top: -12px;
        }

        .lineOne {
            text-align: center;
        }

        .lineOne span {
            max-height: 20px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: center;
        }
    </style>
</head>
<body>
<section v-cloak class="content" id="app" style="padding: 0;min-height: 100vh">
    <div class="div-td-content-more"><i></i></div>
    <table class="table table-bordered text-center table-width" style="table-layout: auto">
        <thead>
        <tr>
            <th style="width: 80px">姓名</th>
            <th style="width: 100px">日期</th>
            <th style="width: 200px">罚款说明</th>
            <th style="width: 120px">罚款金额(元)</th>
        </tr>
        </thead>
        <tbody>
        <tr v-for="(item,i) in list">
            <td :rowspan="item.userNamespan" :class="{hidden: item.userNamedis}">{{userName}}</td>
            <td :rowspan="item.dayspan" :class="{hidden: item.daydis}">{{item.day}}</td>
            <td class="lineOne"><span>{{item.remark}}</span></td>
            <td>{{item.money}}</td>
        </tr>
        <tr>
            <td colspan="3">合计</td>
            <td>{{getAll}}</td>
        </tr>
        </tbody>
    </table>
</section>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=8e743a31"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oaApp.js"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script>
    $(function () {
        $("body").on("click", ".lineOne", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
</script>
<script type="text/javascript">
    var app = new Vue({
        el: '#app',
        data: {
            list: [],
            userId: getUrlParamObj().userId,
            userName: getUrlParamObj().userName,
            dateTime: getUrlParamObj().dateTime,
            companyId: getUrlParamObj().companyId,
            bigRegionId: getUrlParamObj().bigRegionId,
            roleName: getUrlParamObj().roleName,
            getAll: 0
        },
        methods: {
            //获取合计
            getCount: function (arr, key) {
                var number = 0;
                for (var i = arr.length - 1; i >= 0; i--) {
                    number += Number(arr[i][key] && arr[i][key] != '-' ? arr[i][key] : 0)
                }
                return number;
            },
            tablesMergeCell: function (list) {
                for (field in list[0]) {
                    var k = 0;
                    while (k < list.length) {
                        list[k][field + 'span'] = 1;
                        list[k][field + 'dis'] = false;
                        for (var i = k + 1; i <= list.length - 1; i++) {
                            if (list[k][field] == list[i][field] && list[k][field] != '') {
                                list[k][field + 'span']++;
                                list[k][field + 'dis'] = false;
                                list[i][field + 'span'] = 1;
                                list[i][field + 'dis'] = true;
                            } else {
                                break;
                            }
                        }
                        k = i;
                    }
                }
                return list;
            }
        },
        mounted: function () {
            var that = this;
            var data = {
                userId: that.userId,
                dateTime: that.dateTime,
                companyId: that.companyId,
                bigRegionId: that.bigRegionId,
                roleName: that.roleName,
            };
            $.ajax({
                url: server.ip + '/bonus/getBonus.json',
                contentType: 'application/json;charset=utf-8',
                type: "POST",
                data: JSON.stringify(data),
                success: function (r) {
                    var res = JSON.parse(r)
                    var data = res.data.sendData;
                    console.log(data);
                    for (var i = 0; i < data.length; i++) {
                        data[i].userName = that.userName;
                    }
                    that.list = that.tablesMergeCell(data);
                    that.getAll = that.getCount(data, 'money')

                },
                error: function (e) {
                    alert(e.responseText)
                }
            });
        }

    });
</script>

</body>
</html>